﻿
@{
    ViewBag.Title = "SystemRoleEdit";
    Layout = "~/Views/Shared/_LayoutMain.cshtml";
}


@section css{
    <link href="~/Assets/css/lib/fileinput.css" rel="stylesheet" />
    <link href="~/Assets/css/lib/bootstrap-datetimepicker.min.css" rel="stylesheet" />
    <link href="~/Assets/css/lib/bootstrap-select.css" rel="stylesheet" />
}

<header id="topbar">
    <div class="topbar-left">
        <ol class="breadcrumb">
            <li class="crumb-active">
                <a>编辑角色</a>
            </li>
            <li class="crumb-trail">角色管理</li>
        </ol>
    </div>
</header>

<div id="content" ng-cloak ng-controller="SystemConfigController" ng-init="page='@(Request.QueryString["page"].IsEmpty() ? "1" : Request.QueryString["page"])';
     Id='@(Request.QueryString["Id"].IsEmpty() ? "1" : Request.QueryString["Id"])';
    GetSystemModuleList();
    PageLoading = false;
    LoadingMsg='加载中,请稍后...';
     GetRoleDetail(Id);
     GetRoleModule(Id);">
    <div class="load" ng-show="PageLoading">
        <div class="loader">
            <svg version="1.1" id="loader-1" x="0px" y="0px" width="100px" height="100px" viewBox="0 0 50 50" style="enable-background:new 0 0 50 50;" xml:space="preserve">
            <path fill="#000" d="M43.935,25.145c0-10.318-8.364-18.683-18.683-18.683c-10.318,0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615c8.072,0,14.615,6.543,14.615,14.615H43.935z">
            <animateTransform attributeType="xml" attributeName="transform" type="rotate" from="0 25 25" to="360 25 25" dur="0.6s" repeatCount="indefinite" />
			</path>
		</svg>
            <div class="load-msg" ng-bind="LoadingMsg"></div>
        </div>
    </div>
    <div class="row">
        <div class="col-md-12">
            <div class="panel panel-info panel-border top mb35">
                <div class="panel-heading">
                    <span class="panel-title">编辑角色</span>
                </div>
                <div class="panel-body">
                    <form class="form-horizontal row-border">
                        <div class="form-group">
                            <label class="col-sm-2 control-label">权限名称</label>
                            <div class="col-sm-8">
                                <input type="text" class="form-control" ng-model="EditModel.RoleName">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">是否超管</label>
                            <div class="col-sm-8">
                                <label style="margin-left:10px;margin-top:10px;" ng-click="EditModel.IsAdmin=1">
                                    <input type="radio" id="IsAdmin1" name="IsAdmin" value="1" ng-checked="EditModel.IsAdmin">是
                                </label>
                                <label style="margin-left:10px;margin-top:10px;" ng-click="EditModel.IsAdmin=0">
                                    <input type="radio" id="IsAdmin0" name="IsAdmin" ng-checked="!EditModel.IsAdmin" value="0">否
                                </label>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">公司领导</label>
                            <div class="col-sm-8">
                                <label style="margin-left:10px;margin-top:10px;" ng-click="EditModel.IsLeader=1">
                                    <input type="radio" id="IsLeader1" name="IsLeader" value="1" ng-checked="EditModel.IsLeader">是
                                </label>
                                <label style="margin-left:10px;margin-top:10px;" ng-click="EditModel.IsLeader=0">
                                    <input type="radio" id="IsLeader0" name="IsLeader" ng-checked="!EditModel.IsLeader" value="0">否
                                </label>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">部门领导</label>
                            <div class="col-sm-8">
                                <label style="margin-left:10px;margin-top:10px;" ng-click="EditModel.IsDepartmentLeader=1">
                                    <input type="radio" id="IsDepartmentLeader1" name="IsDepartmentLeader" ng-checked="EditModel.IsDepartmentLeader" value="1">是
                                </label>
                                <label style="margin-left:10px;margin-top:10px;" ng-click="EditModel.IsDepartmentLeader=0">
                                    <input type="radio" id="IsDepartmentLeader0" name="IsDepartmentLeader" ng-checked="!EditModel.IsDepartmentLeader" value="0">否
                                </label>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">描述/备注</label>
                            <div class="col-sm-8">
                                <input type="text" class="form-control" ng-model="EditModel.Description">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">权限配置</label>
                            <div class="col-sm-8">
                                <table class="table table-striped table-bordered" style="text-align:center;" ng-show="!PageLoading">
                                    <thead>
                                        <tr>
                                            <th style="text-align: center; width: 5%">序号</th>
                                            <th style="text-align: center; width: 20%">模块</th>
                                            <th style="text-align: center; width: 20%">页面</th>
                                            <th style="text-align: center; width: 10%">查看<input type="checkbox" id="CheckedAllView" ng-click="CheckAll('CheckedAllView','View');" /></th>
                                            <th style="text-align: center; width: 10% ">新增<input type="checkbox" id="CheckedAllAdd" ng-click="CheckAll('CheckedAllAdd','Add');" /></th>
                                            <th style="text-align: center; width: 10%">编辑<input type="checkbox" id="CheckedAllModify" ng-click="CheckAll('CheckedAllModify','Modify');" /></th>
                                            <th style="text-align: center; width: 10%">删除<input type="checkbox" id="CheckedAllDelete" ng-click="CheckAll('CheckedAllDelete','Delete');" /></th>
                                            <th style="text-align: center; width: 10%">默认页面</th>
                                        </tr>
                                    </thead>
                                    <tbody ng-repeat="c in ModuleList track by $index">
                                        <tr ng-repeat="x in c.NodeList track by $index">
                                            <td ng-if="$index ==0" rowspan={{c.NodeList.length}}>{{$parent.$parent.$index+1}}</td>
                                            <td ng-if="$index ==0" rowspan={{c.NodeList.length}}>{{c.MenuName}}</td>
                                            <td>{{x.NodeName}}</td>
                                            <td><input type="checkbox" id="View_{{x.Id}}" /></td>
                                            <td><input type="checkbox" id="Add_{{x.Id}}" /></td>
                                            <td><input type="checkbox" id="Modify_{{x.Id}}" /></td>
                                            <td><input type="checkbox" id="Delete_{{x.Id}}" /></td>
                                            <td><input type="radio" id="Default_{{x.Id}}" name="defaultpage" ng-checked="EditModel.DefaultPage==x.Path" value="{{x.Path}}" /></td>
                                        </tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="panel-footer">
                    <button class="btn-primary btn" ng-click="EditRole(EditModel,page);">保存</button>
                    <a href="SystemRoleList?page={{page}}" class="btn-default btn">取消</a>
                </div>
            </div>
        </div>
    </div>
</div>

@section Js{
    <script src="~/Bussiness/js/libs/upload.js"></script>
    <script src="~/Bussiness/js/pg/Organization.js?v=@DateTime.Now.ToString("yyMMddHHmm")"></script>
    <script src="~/Bussiness/js/libs/moment.min.js"></script>
    <script src="~/Bussiness/js/libs/locales/date/zh-cn.js"></script>
    <script src="~/Bussiness/js/libs/bootstrap-datetimepicker.min.js"></script>
    <script src="~/Bussiness/js/libs/angularjs-datepicker.js"></script>
    <script src="~/Bussiness/js/libs/fileinput.js"></script>
    <script src="~/Bussiness/js/libs/zh.js"></script>
    <script>
        $('#docfiles').fileinput({
            language: 'zh',
            allowedFileExtensions: ['xls', 'xlsx']
        });
    </script>
}


